package com.xianniu.ltc.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xianniu.ltc.model.entity.TXnAccountDTO;
import com.xianniu.ltc.model.po.*;
import com.xianniu.ltc.model.vo.XnAccountVO;
import com.xianniu.ltc.model.vo.XnLeadVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @description 客户表
 * @author zhangyang@zencor.cn
 * @date 2021-05-19
 */
@Mapper
public interface TXnAccountMapper extends BaseMapper<TXnAccountDTO> {

    @InterceptorIgnore(tenantLine = "on")
    IPage<XnAccountVO> selectPageList(@Param("page") Page page, @Param("po") QueryAccountAdminPO po, @Param("delYn") Integer delYn, @Param("tenantCode") String tenantCode);

    @InterceptorIgnore(tenantLine = "on")
    IPage<XnAccountVO> selectFallbackPageList(@Param("page") Page page, @Param("po") QueryAccountAdminPO po, @Param("delYn") Integer delYn, @Param("tenantCode") String tenantCode);

    XnAccountVO detailPAccountForAdmin(String id);

    XnAccountVO detailCAccountForAdmin(String id);

    int updateBatchForIdList(@Param("list") List<String> list, @Param("teamId") String teamId);

    int deleteBatchForIdList(@Param("list") List<String> list);
    /**
     * 转移分组：修改私海客户的客户组
     * @return
     */
    int transferPAccountTeamForAdmin(@Param("fromATeam") String fromATeam, @Param("toTeam") String toTeam);

    /**
     * 转移分组：修改公海客户的客户组
     * @return
     */
    int transferCAccountTeamForAdmin(@Param("fromATeam") String fromATeam, @Param("toTeam") String toTeam);

    int deleteAccount(String id);


    @InterceptorIgnore(tenantLine = "on")
    List<XnAccountVO> selectAccountForRecycle( @Param("po") QueryAccountHighSeaPO po, @Param("list")List<String> deptArray, @Param("delYn") Integer delYn, @Param("tenantCode") String tenantCode);

    @InterceptorIgnore(tenantLine = "on")
    List<XnAccountVO> selectHighSeaPageList( @Param("po") QueryAccountHighSeaPO po, @Param("list")List<String> deptArray, @Param("delYn") Integer delYn, @Param("tenantCode") String tenantCode);

    @InterceptorIgnore(tenantLine = "on")
    List<XnAccountVO> selectCommonHighSeaPageList( @Param("po") QueryAccountHighSeaPO po, @Param("list")List<String> deptArray, @Param("delYn") Integer delYn, @Param("tenantCode") String tenantCode);
    /**
     * 查询勾选的线索对应的负责人：判断是不是当前登录人
     */
    String selectHeadBy(String id);

    int receiveAccount(String id, String receiveBy);


    /**
     * 根据当前登录人是领取人：查询私海线索
     * @param page
     * @param po
     * @param receiveBy
     * @param delYn
     * @param tenantCode
     * @return
     */
    @InterceptorIgnore(tenantLine = "on")
    IPage<XnAccountVO> selectAccountForPrivateSea(@Param("page") Page page, @Param("po") QueryAccountHighSeaPO po, @Param("receiveBy") String receiveBy, @Param("delYn") Integer delYn, @Param("tenantCode") String tenantCode);

    int putBackById(String id);

    List<XnAccountVO> selectExportList(@Param("page") Page page, @Param("po") QueryAccountAdminPO po, @Param("tenantCode") String tenantCode);

}

